package com.pie4cloud.pie.job.executor.services.impl.statistical;

import com.pie4cloud.pie.job.executor.dto.StatisticalRequest;
import com.pie4cloud.pie.job.executor.enums.StatisticalType;
import com.pie4cloud.pie.job.executor.services.impl.StatisticalBaseServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class DispenseStatisticalServiceImpl extends StatisticalBaseServiceImpl {
	public StatisticalType getStatisticalType() {
		return StatisticalType.DISPENSE;
	}

	public void doOperation(StatisticalRequest statisticalRequest) {
		String statisticalKey =STATISTICAL_DISPENSE+statisticalRequest.getPlaybillId()+":"+statisticalRequest.getWhenTime()+":"+statisticalRequest.getFtpId();
		String statisticalNum=STATISTICAL_NUM+statisticalRequest.getPlaybillId()+":"+statisticalRequest.getWhenTime()+":"+statisticalRequest.getFtpId();
		super.doExecute(statisticalKey,statisticalNum,statisticalRequest);
	}

	public boolean check(StatisticalRequest statisticalRequest){
		String statisticalKey=STATISTICAL_DISPENSE+statisticalRequest.getPlaybillId()+":"+statisticalRequest.getWhenTime()+":"+statisticalRequest.getFtpId();
		return redisUtil.sHasKey(statisticalKey,statisticalRequest.getFilePath());
	};
}
